class Solution {
public:
    int maximumProduct(vector<int>& nums) {
        int k=nums.size()-1;
        sort(nums.begin(),nums.end());
        return max(nums[0]*nums[1]*nums[k],nums[k]*nums[k-1]*nums[k-2]);
    }
};